<?php
//including header.php 
include '../../include/header.php';
//including page.php (It is a class which contain functions)
include '../../libraries/page.php';
//created object for page.php
$page = new page();
session_start();
$userid = $_SESSION['userid'];

//To get current date and time
date_default_timezone_set('Asia/Calcutta');
$date1 = date("Y-m-d H:i:s");

// checking the session
if (!$_SESSION['username']) {
    header("location:../user/login.php");
}
if ($_GET['q'] == 'logout') {
    $page->user_logout();
    header("location:../user/login.php");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $result = $page->mysql_insert_array("suppliers", $_POST, "submit");
    if ($result) {
        $msg = $message[1];
    } else {
        $msg = $message[0];
    }
}
$suppliers = 'active';
include '../../include/navbar.php';
?>

   <div class="bread_crumb" style="margin-left: 2%">
       &laquo;  <a href="suppliers">Back</a>
  </div>
<!--------------------------------------------------content----------------------------------->

<!----------------------------------Display the result message of Addition--------------------->
<div  align="center"><? echo $msg; ?></div>

<!----------------------------------------------div for placing form here------------------------->
<div style="width: 500px;margin-left: auto;margin-right: auto;margin-top: 50px;">
    <h3 style="color:#777;text-align: center"> Add Supplier</h3>
    <br />

    <!---------------------------------form------------------------------------------------>
    <form method="POST"  action="">
        <table>
            <tr><td>
                    <label>Name</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="name" placeholder="Enter Name..."  required>
                </td><td style="width:100px">&nbsp;</td><td>
                    <label>Address</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="address" placeholder="Enter Address..."  >
                </td></tr>
            <tr><td>
                    <label>Street</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="street" placeholder="Enter Street(Optional)..." >
                </td><td class="mid">&nbsp;</td><td>
                    <label>City</label>
                    <input class="input-xlarge" id="focusedInput" type="text"  name ="city" placeholder="Enter City..."  >
                </td></tr>
            <tr><td>
                    <label>State</label>
                    <select  name="state">

                        <option>Andhra Pradesh</option>
                        <option>Arunachal pradesh</option>
                        <option>Andaman and Nicobar Islands</option>
                        <option>Assam</option>
                        <option>Bihar</option>
                        <option>Chattisgarh</option>
                        <option>Chandigarh</option>
                        <option>Dadar and Nagar Haveli</option>
                        <option>Daman and Diu</option>
                        <option>Delhi</option>
                        <option>Goa</option>
                        <option>Gujarat</option>
                        <option>Haryana</option>
                        <option>Himachal Pradesh</option>
                        <option>Jammu and Kashmir</option>
                        <option>Jharkhand</option>
                        <option>Karnataka</option>
                        <option>Kerala</option>
                        <option>Lakshadweep</option>
                        <option>Madhya Pradesh</option>
                        <option>Maharashtra</option>
                        <option>Manipur</option>
                        <option>Meghalaya</option>
                        <option>Mizoram</option>
                        <option>Nagaland</option>
                        <option>Orrisa</option>
                        <option>Pondicherry</option>
                        <option>Punjab</option>
                        <option>Rajasthan</option>
                        <option>Sikkim</option>
                        <option>Tamil Nadu</option>
                        <option>Tripura</option>
                        <option>Uttar Pradesh</option>
                        <option>Uttarakhand</option>
                        <option>West Bengal</option>

                    </select>
                </td><td class="mid">&nbsp;</td><td>
                    <label>Mobile</label>
                    <input class="input-xlarge" id="focusedInput" type="tel" name ="mobile" placeholder="Maximum 12 digits..."   >
                </td></tr>
            <tr><td>
                    <label>Phone</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="phone" placeholder="Enter Phone Number(optional)..."  >
                </td><td class="mid">&nbsp;</td><td>
                    <label>Tax ID Number</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="TaxIDNumber" placeholder="Enter Tax ID..."  >
                    <input class="input-xlarge" id="focusedInput" type="hidden" name="c_user" value ="<? echo $userid; ?>"  >
                    <input class="input-xlarge" id="focusedInput" type="hidden" name="C_date" value ="<? echo $date1; ?>"  >
                    <input class="input-xlarge" id="focusedInput" type="hidden" name="m_user" value ="None"  >
                    <input class="input-xlarge" id="focusedInput" type="hidden" name="m_date" value =""  >
                </td></tr>
            <tr><td colspan="3">
                    <button class="btn btn-inverse" type="submit" name = "submit" style="float:right; margin-right: 5px; margin-top: 20px;">Add Supplier</button>
                </td></tr>
        </table>

    </form>
</div>

<?php
//including footer.php
include '../../include/footer.php';
?>

